<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>积分明细</title>
<meta name="viewport" content="width=100%, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/lib/weix/style/weui.min.css">
<link rel="stylesheet" href="/css/fonts.css">
<link rel="stylesheet" href="/css/comm.css">
<link rel="stylesheet" href="/css/list_hej.css">
</head>

<body>
<div id="J_list">

</div>

<div class="weui-loadmore" id="J_loadmore" style="display:none;">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">正在加载</span>
</div>
<script src="/js/zepto.min.js"></script>
<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
<script src="/js/comm.js"></script>
<script type="text/javascript">
function getCustomerList(){
	var uid = "${uid}";
	var all = "${all}";
	var type = 1;	// 来源/0:客户成交/1:发展合伙人/2:推荐成交/3:转发任务/4:兑换产品
	var data = {page:1,rows:1000,uid:uid,all:all,type:type};
	var url = "/points/points_list";

	$('#J_loadmore').show();
	$.ajax({
		type: "POST",
		dataType: 'json',
		async: false,
		contentType: "application/json; charset=utf-8",
		data: JSON.stringify(data),
		url: url,
		success: function(res){
			if(res.code == 200){
				//操作
				var list = res.data.list;
				console.log(list);
				for(var i in list) {
					var shtml ='<div class="th-date__boxs"><div class="th-date__box J_date_box"><span class="tit max">'+i+'</span><span class="more max"></span></div></div>'+
									'<div class="weui-cells top_no lib">'
					var lists =  list[i];
					for (var j =0;j<lists.length;j++){
						
					shtml +=	'<a class="weui-cell weui-cell_access" href="/pointsPage/points_detail/'+lists[j]['id']+'">'
					if(lists[j]['type'] == 0){
					shtml +=		'<div class="weui-cell__hd tb" style="color:#fda906"><i class="icon-tick"></i></div>'
					}else{
					shtml +=		'<div class="weui-cell__hd tb" style="color:#0085f5"><i class="icon-exchange"></i></div>'
					}

					//积分途径
					shtml +=		'<div class="weui-cell__bd">'+
										'<div class="th-info__tit">'+lists[j]['title']+'</div>'
					//积分类型
					switch(lists[j]['source']){			// 来源/0:客户成交/1:发展合伙人/2:推荐成交/3:转发任务/4:兑换产品
					case 1 : shtml +=	'<div class="th-info__fbt">[发展合伙人]</div>'; break;
					case 2 : shtml +=	'<div class="th-info__fbt">[推荐成交]</div>'; break;
					case 3 : shtml +=	'<div class="th-info__fbt">[转发任务]</div>'; break;
					case 4 : shtml +=	'<div class="th-info__fbt">[兑换奖品]</div>'; break;
					default :shtml +=	'<div class="th-info__fbt">[带单成交]</div>'; break;
					}

					shtml +=			'<div class="th-info__time">'+lists[j]['addtime']+'</div>'+
									'</div>'+
									'<div class="weui-cell__ft max">'+lists[j]['point']+'</div>'+
								'</a>'
					}
					shtml += '</div>'
					
					$('#J_list').append(shtml);
				};

			}else{
				weui.topTips(res.msg);
			}
		},
		error: function(e){

		},
		complete: function(e){
			$('#J_loadmore').hide();
		}
	});

}

$(function(){
	getCustomerList();
	
	//月份
	$(window).bind('scroll', function(){ 
		var scrollTop = document.body.scrollTop+document.documentElement.scrollTop;
		
		$('.J_date_box').each(function() {
        	var $this_t = $(this)
			var hig_t = $this_t.offset().top
			
			if(scrollTop > hig_t+5){
				$('.J_date_box').removeClass('fix')
				$this_t.addClass('fix')
			}else{
				$this_t.removeClass('fix')
			}
        });
	});
});
</script>
</body>
</html>
